package it.rap.applications.persistence.entities.contoCorrente;

import it.rap.applications.persistence.entities.movimento.Movimento;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

@Entity
public class ContoCorrente {
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	private BigDecimal 	id;
	private String		banca;
	private String 	   	iban;
	private Integer		state;
	@Temporal(value = TemporalType.DATE)
	private Date		dataAccensione;
	@Temporal(value = TemporalType.DATE)
	private Date		dataChiusura;
	private String 	   	description;
	@Version
	private Long 		versione;
	
	@OneToMany( cascade = CascadeType.ALL, orphanRemoval=true, mappedBy="contoCorrente")
	private List<Movimento> movimentiList = new ArrayList<Movimento>();

	/**
	 * @return the id
	 */
	public BigDecimal getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(BigDecimal id) {
		this.id = id;
	}
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	/**
	 * @return the versione
	 */
	public Long getVersione() {
		return versione;
	}
	/**
	 * @param versione the versione to set
	 */
	public void setVersione(Long versione) {
		this.versione = versione;
	}
	/**
	 * @return the movimentiList
	 */
	public List<Movimento> getMovimentiList() {
		return movimentiList;
	}
	/**
	 * @param movimentiList the movimentiList to set
	 */
	public void setMovimentiList(List<Movimento> movimentiList) {
		this.movimentiList = movimentiList;
	}
	/**
	 * @return the banca
	 */
	public String getBanca() {
		return banca;
	}
	/**
	 * @param banca the banca to set
	 */
	public void setBanca(String banca) {
		this.banca = banca;
	}
	/**
	 * @return the iban
	 */
	public String getIban() {
		return iban;
	}
	/**
	 * @param iban the iban to set
	 */
	public void setIban(String iban) {
		this.iban = iban;
	}
	/**
	 * @return the dataAccensione
	 */
	public Date getDataAccensione() {
		return dataAccensione;
	}
	/**
	 * @param dataAccensione the dataAccensione to set
	 */
	public void setDataAccensione(Date dataAccensione) {
		this.dataAccensione = dataAccensione;
	}
	/**
	 * @return the dataChiusura
	 */
	public Date getDataChiusura() {
		return dataChiusura;
	}
	/**
	 * @param dataChiusura the dataChiusura to set
	 */
	public void setDataChiusura(Date dataChiusura) {
		this.dataChiusura = dataChiusura;
	}
	public Integer getState() {
		return state;
	}
	public void setState(Integer state) {
		this.state = state;
	}

}
